New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@discord-player/utils

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@discord-player/utils

Discord Player Utilities

  • 0.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2K
decreased by-7.03%
Maintainers
2
Weekly downloads
 
Created
Source

@discord-player/utils

Discord Player utilities

Installation

$ yarn add @discord-player/utils

Example

Queue

import { Queue } from "@discord-player/utils";

// initialize queue with last-in-first-out strategy
const lifo = new Queue<number>("LIFO");
// initialize queue with first-in-first-out strategy
const fifo = new Queue<number>("FIFO");

// add some data to the queue
lifo.add([1, 2, 3, 4]);
fifo.add([1, 2, 3, 4]);

// dispatches last inserted item from the queue
console.log(lifo.dispatch()); // 4

// dispatches first inserted item from the queue
console.log(fifo.dispatch()); // 1

console.log(lifo.at(0)); // 3
console.log(fifo.at(0)); // 2

Collection

import { Collection } from "@discord-player/utils";

// utility data structure based on Map
const store = new Collection<string, number>();

store.set("foo", 1);

console.log(store.get("foo")); // 1
store.delete("foo"); // true
console.log(store.get("foo")); // undefined
store.delete("foo"); // false

Key Mirror

import { keyMirror } from "@discord-player/utils";

// creates read-only object with same value as the key
const enums = keyMirror([
    "SUNDAY",
    "MONDAY",
    "TUESDAY"
]);

console.log(enums);

/*
{
    "SUNDAY": "SUNDAY",
    "MONDAY": "MONDAY",
    "TUESDAY": "TUESDAY"
}
*/

Keywords

FAQs

Package last updated on 06 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc